{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "from sklearn.linear_model import LogisticRegression\n",
    "import matplotlib.pyplot as plt\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "X_train =  np.r_[np.random.normal(3, 1, size=50),np.random.normal(-1, 1, size=50)].reshape((100, -1)) # 生成训练集，均值为3，标准差为1，样本数量为50，后面是均值为-1，标准差为1，样本数量为50，连接在一起\n",
    "\n",
    "y_train = np.r_[np.ones(50), np.zeros(50)] # 生成训练集标签，前50个样本为1，后50个样本为0\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.09675962, 0.57556852, 0.94495438])"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAiMAAAGdCAYAAADAAnMpAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/NK7nSAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAlNklEQVR4nO3df3RU9Z3/8ddMIBOQZABDfgCRRG1VSoESSBosttTUqFtct6cux1aI2dZWDnrQbL8rsUJgaw3+LLtCibKtetpyoPaU/pLS2qzIusZiky/foyK4CJgcIAkRzcQgic7M9w83I0Mmyb3DDG8Tno9z7jlw8/ncz/tz703ui5s7F084HA4LAADAiNe6AAAAcG4jjAAAAFOEEQAAYIowAgAATBFGAACAKcIIAAAwRRgBAACmCCMAAMDUCOsCnAiFQjpy5IjS09Pl8XisywEAAA6Ew2F1dnZq4sSJ8nr7v/8xJMLIkSNHlJeXZ10GAACIQ3NzsyZPntzv14dEGElPT5f00WQyMjKMqwEAAE4EAgHl5eVFruP9GRJhpPdXMxkZGYQRAACG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vz+y5OXluSkTAAAMIUn9NE1nZ6cWLVqkjRs3KjMz03G/qqoqdXR0RJbm5uYkVgkAACyNcNM4MzNTKSkpam1tjVrf2tqqnJycPu3ffPNNHTp0SAsWLIisC4VCHw08YoT27duniy66qE8/n88nn8/npjQAADBEubozkpqaqsLCQtXV1UXWhUIh1dXVqaSkpE/7Sy+9VK+88op2794dWa677jrNnz9fu3fv5tcvAADA3Z0RSaqsrFR5eblmz56toqIirV27Vl1dXaqoqJAkLV68WJMmTVJNTY3S0tI0bdq0qP5jx46VpD7rAQDAucl1GFm4cKGOHTumlStXqqWlRTNnztT27dsjD7U2NTXJ6+XFrgAAwBlPOBwOWxcxmEAgIL/fr46ODmVkZFiXAwAAHHB6/eYWBgAAMEUYAQAApggjAADAFGEEAACYIowAAABThBEAAGCKMAIAAEwRRgAAgCnCCAAAMEUYAQAApggjAADAFGEEAACYIowAAABThBEAAGCKMAIAAEwRRgAAgCnCCAAAMEUYAQAApggjAADAFGEEAACYIowAAABThBEAAGCKMAIAAEwRRgAAgCnCCAAAMEUYAQAApggjAADAFGEEAACYIowAAABThBEAAGCKMAIAAEwRRgAAgCnCCAAAMEUYAQAApggjAADAFGEEAACYIowAAABThBEAAGCKMAIAAEwRRgAAgCnCCAAAMEUYAQAApggjAADAFGEEAACYIowAAABThBEAAGCKMAIAAEwRRgAAgCnCCAAAMEUYAQAApggjAADAFGEEAACYIowAAABThBEAAGCKMAIAAEwRRgAAgKm4wsj69euVn5+vtLQ0FRcXa9euXf223bhxo+bNm6dx48Zp3LhxKi0tHbA9AAA4t7gOI1u2bFFlZaWqq6vV2NioGTNmqKysTG1tbTHb79ixQzfeeKOee+451dfXKy8vT1dddZUOHz58xsUDAIChzxMOh8NuOhQXF2vOnDlat26dJCkUCikvL0+33367li9fPmj/YDCocePGad26dVq8eLGjMQOBgPx+vzo6OpSRkeGmXAAAYMTp9dvVnZGenh41NDSotLT04w14vSotLVV9fb2jbZw4cUIffPCBxo8f32+b7u5uBQKBqAUA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TLyMg4J07wU51rc2a+w9+5Nudzbb7SuTfnM53vQHdEevEAKwAAMEUYAQAApggjnwA+n0/V1dXy+XzWpZw159qcme/wd67N+Vybr3TuzflszndIPMAKAACGL+6MAAAAU4QRAABgijACAABMEUYAAIApwsgnzKFDh/Stb31LBQUFGjVqlC666CJVV1erp6fHurSk+eEPf6i5c+dq9OjRGjt2rHU5SbF+/Xrl5+crLS1NxcXF2rVrl3VJSbNz504tWLBAEydOlMfj0W9+8xvrkpKmpqZGc+bMUXp6urKysnT99ddr37591mUl1YYNGzR9+vTIi7BKSkr0xz/+0bqss2bNmjXyeDy64447rEtJmlWrVsnj8UQtl156aVLHJIx8wuzdu1ehUEiPPfaYXnvtNf3oRz9SbW2t7r77buvSkqanp0c33HCDlixZYl1KUmzZskWVlZWqrq5WY2OjZsyYobKyMrW1tVmXlhRdXV2aMWOG1q9fb11K0j3//PNaunSpXnrpJT377LP64IMPdNVVV6mrq8u6tKSZPHmy1qxZo4aGBv3tb3/Tl7/8Zf393/+9XnvtNevSku7ll1/WY489punTp1uXknSf+cxndPTo0cjywgsvJHfAMD7xHnjggXBBQYF1GUn3xBNPhP1+v3UZCVdUVBReunRp5O/BYDA8ceLEcE1NjWFVZ4ek8NatW63LOGva2trCksLPP/+8dSln1bhx48L/8R//YV1GUnV2doY/9alPhZ999tnwF7/4xfCyZcusS0qa6urq8IwZM87qmNwZGQI6Ojo0fvx46zIQh56eHjU0NKi0tDSyzuv1qrS0VPX19YaVIRk6Ojok6Zz5fg0Gg9q8ebO6urpUUlJiXU5SLV26VH/3d38X9b08nP3P//yPJk6cqAsvvFDf/OY31dTUlNTxhsR/lHcu279/vx599FE99NBD1qUgDu3t7QoGg8rOzo5an52drb179xpVhWQIhUK64447dPnll2vatGnW5STVK6+8opKSEp08eVJjxozR1q1bNXXqVOuykmbz5s1qbGzUyy+/bF3KWVFcXKwnn3xSl1xyiY4eParVq1dr3rx5evXVV5Wenp6UMbkzcpYsX768zwNBpy+nX5wOHz6sq6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AwRRgBAACm/j9/MWHUgDkA2AAAAABJRU5ErkJggg==",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%matplotlib inline\n",
    "\n",
    "model = LogisticRegression()\n",
    "model.fit(X_train, y_train)\n",
    "plt.scatter(X_train, y_train)\n",
    "\n",
    "model.predict_proba([[0,2],[1],[2]])[:,1] #这个函数表示预测输入为0，1，2时的正类概率\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "ml",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
